//
//  myMovieViewController.m
//  个人项目(豆瓣元旦作业)
//
//  Created by dllo on 16/1/8.
//  Copyright © 2016年 guoguo. All rights reserved.
//

#import "myMovieViewController.h"
#import "MovieTableViewCell.h"
#import "HGDataBase.h"
#import "Movie.h"
@interface myMovieViewController ()<UITableViewDataSource, UITableViewDelegate>


@property (nonatomic, retain) UITableView *tableView;



@end

@implementation myMovieViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
        
    self.navigationItem.title = @"我的电影";
    
    self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds];
    
    _tableView.delegate = self;
    _tableView.dataSource = self;
    
    [self.view addSubview:_tableView];
    
    [_tableView registerClass:[MovieTableViewCell class] forCellReuseIdentifier:@"cell"];
    
    
    [_tableView setEditing:YES animated:YES];
    
}

- (void)setEditing:(BOOL)editing animated:(BOOL)animated{
    
    [super setEditing:editing animated:animated];
    
    
}




- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return _arr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    MovieTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    
    Movie *model = _arr[indexPath.row];
//    NSMutableArray *arr1 = [NSMutableArray array];
//    for (Movie *model1 in _arr) {
//        [arr1 addObject:model1.title];
//    }
//    NSLog(@"%@", arr1);
//    if (indexPath.row == 1)
        cell.label.text = model.title;
    
//    cell.label.text = model.title;
    
//    [_tableView reloadData];
    return cell;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
